import {
    getOrderDetail
} from "../../utils/config"
import store from "../../utils/factory"
const util = require('../../utils/util.js')

const app = getApp()

Page({
    data: {
        detail: {}
    },
    onLoad: function(e) {
        // console.log(e.id)
        this.getOrderDetail(e.id)
    },
    onShow() {

    },
    pass() {
        wx.showModal({
            content: "是否确认收货",
            showCancel: true,
            success: function(res) {
                console.log(res)
                if (res.confirm) {
                    passOrder({
                        id: this.data.detail.id
                    }).then(res => {
                        wx.showToast({
                            title: '确认收货成功',
                            duration: 1000
                        })
                    })
                }
            }
        })
    },
    getOrderDetail(id) {
        getOrderDetail({
            id: id
        }).then(res => {
            let req = res.data;
            this.setData({
                detail: req
            })
        })
    }
})